package homework.day04;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author ThinkBook
 */
public class Test02 {
    public static void main(String[] args) {
        int[][] arr = new int[3][3];
        Scanner sc = new Scanner(System.in);
        for (int i=0;i<3;i++){
            for (int j = 0;j<3;j++){
                System.out.println("请输入第"+i+"行，第"+j+"列的数：");
                arr[i][j] = sc.nextInt();
            }
        }
        System.out.println("二维数组按照要求输出格式为：");
        for (int i=0;i<3;i++){
            System.out.print("[");
            for (int j = 0;j<3;j++){
                if(j<2) {
                    System.out.print(arr[i][j] + ",");
                }else{
                    System.out.print(arr[i][j]);
                }
            }
            System.out.println("]");
        }
    }
    public static void main01(String[] args) {
        String[] arr = new String[]{"hello","world","!"};
        //普通for循环
        for (int i=0;i<=arr.length;i++){
            System.out.println(arr[i]);
        }
        //增强for循环
        for (String str : arr){
            System.out.println(str);
        }
    }
}
